package com.ebc.eservice.mapper;

import com.ebc.eservice.pojo.EbcCardStat;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ebc.eservice.vo.card.history.TotalCardStat;
import com.ebc.eservice.vo.card.totalStat.SectorStatDto;
import com.ebc.eservice.vo.card.totalStat.TotalRespVo;
import org.apache.ibatis.annotations.Update;

import java.util.Date;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author joey
 * @since 2022-09-27
 */
public interface EbcCardStatMapper extends BaseMapper<EbcCardStat> {

    //访问
    @Update("update ebc_card_stat set visit_num = visit_num + 1 where date_flag = #{createTime}")
    void addVisit(String createTime);
    //访问
    @Update("update ebc_card_stat set stay_times = #{stayTimes} where date_flag = #{createTime}")
    void addStayTime(int stayTimes,String createTime);

    //下载
    @Update("update ebc_card_stat set download_num = download_num +1 where date_flag = #{createTime}")
    void addDownload(String createTime);
    //添加通讯录
    @Update("update ebc_card_stat set add_contact_num = add_contact_num+1 where date_flag = #{createTime}")
    void addContact(String createTime);
    //转发
    @Update("update ebc_card_stat set forward_num = forward_num+1 where date_flag= #{createTime}")
    void addForward(String createTime);
    //转发
    @Update("update ebc_card_stat set copy_wx_account = copy_wx_account+1 where date_flag= #{createTime}")
    void addCopyWx(String createTime);
    //留言
    @Update("update ebc_card_stat set message_num = message_num+1 where date_flag=#{createTime}")
    void addMessage(String createTime);

    TotalCardStat getCardHistoryByDate(Integer cardId, String beginDate,String endDate);

    //名片id获取访客概况
    TotalCardStat getCardTotalStat(Integer cardId);

    //获取公司 6个月访客
    TotalRespVo getTotalVisitByMonth(Integer companyId,Integer Month);


    //一级部门统计 访问和转发
    SectorStatDto getSectorVisitActiveNum(Integer sectorId);
    //一级部门人数
    SectorStatDto getSectorNum(Integer sectorId);
    //一级部门客户统计  瑕疵 共有客户
    SectorStatDto getSectorClient(Integer sectorId);

    //二级部门统计 访问和转发
    SectorStatDto getSectorChildVisitActiveNum(Integer sectorId);
    //二级部门人数
    SectorStatDto getSectorChildNum(Integer sectorId);
    //二级部门客户统计  瑕疵 共有客户
    SectorStatDto getSectorChildClient(Integer sectorId);

}
